<template>
	<view class="page">
		<view class="u-page ">

			<u-sticky>
				<u-tabs @change="Ctabs" active-color="#00C08D" :list="tabs" :is-scroll="false" :current="current">
				</u-tabs>
			</u-sticky>
			
			

			<wr-book @controls="controls"  :list="list"  isTechnician="1" ></wr-book>
<u-loadmore :status="initial.status" />
			<!-- 所有内容的容器 -->
		</view>
		<!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
		<u-tabbar @change="Ctabbar" inactive-color="#999999" active-color="#00C08D" v-model="tCurrent" :list="tabbar">
		</u-tabbar>
	</view>
</template>

<script>
	import loader from '@/common/loadPage.js';
	
	import tab from './tabbar.js';
	
	export default {
		mixins: [loader],
		data() {
			return {
				tCurrent: 0,
				tabbar: tab,
				tabs: [{
					name: "全部"
				},  {
					name: "待接单"
				},{
					name: "待服务"
				}, {
					name: "进行中"
				}, {
					name: "已完成"
				}],
				
				
			current:0,

				list: [],
				initial: {
					geturl: "/technician/getOrderList",
					parm: {
					    is_pay_type:"1"
					},
					isPage: true
				},

			}
		},
		methods: {
			controls(item){
					this.$u.post('/order/setOrderStatus', {
						trade_no: item.trade_no,
						status:7
					}).then(res => {
						this.$u.toast("拒绝成功");
						this.initial.page=1;
						this.jiazai()
					}).catch(err => {})
			},
			
			
			Ctabbar(e) {
				uni.redirectTo({
					url: e ? '/pages/center/my' : '/pages/center/index'
				})

			},
			jiazai(){
				this.getGoods().then(res=>{
					let arr = [];
					res.forEach(item=>{
						item.project_info.images= item.project_info.images.split(",") 
						
					});
					this.list = res;
				})
			},
			Ctabs(e) {
				this.current = e;
				this.initial.page=1;
				if(e==0){
					
					this.initial.parm.status=''
					
				}
				if(e==1){
					
					this.initial.parm.status=0
					
					
					
				}
				if(e==2){
					
					
					
					this.initial.parm.status=1
					
				}
				if(e==3){
					
					this.initial.parm.status=4
					
					
				}
				if(e==4){
					
					
					this.initial.parm.status=5
					
					// this.initial.parm.is_pay_type=1
					// this.initial.parm.status=5
				}
				this.jiazai()
			},
		},
		async onShow() {
		     this.jiazai()
		},
		
	}
</script>


<style>
	.page {
		background: #F1F1F1;
		min-height: 100vh;
	}

	.list {
		background: #fff;
		width: 700rpx;
		margin: 20rpx auto;
		padding: 20rpx;
		border-radius: 20rpx;
	}
</style>
